package javabasic.forth;

import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

/**
 * @author Jonny Long
 * @date 2021/2/18 10:29
 */
public class ArgsTest {
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6);
        //System.out.println("输出所有偶数:");
        //Predicate<Integer> predicate1 = n -> n % 2 == 0;
        //eval(list, predicate1);
        //System.out.println("输出大于 3 的所有数字:");
        //Predicate<Integer> predicate2 = n -> n > 3;
        //eval(list, predicate2);
    }

    public static void eval(List<Integer> list, Predicate<Integer> predicate) {
        for (Integer n : list) {
            if (predicate.test(n)) {
                System.out.println(n + " ");
            }
        }
    }
}
